<template lang="html">
  <div class="lengthways-list" @click="goBuy" :style="{borderRadius:radius + 'px'}">
  <div class="shop-img-wrap">
    <img class="big-img" :src="data.product_image"/>
  </div>
  <div class="shop-desc">

    <span class="shop-desc-text">{{data.product_short_name}}</span>
    <div class="prd_tips">{{data.product_tips}}</div>
    <!-- <slot name="tag-text"></slot> -->
    <div class="prd_tag">
        <div class="discount" v-for="(i, index) in data.activity_tab_names" v-bind:key="index">{{i}}</div>
        <!-- <div wx:else class="discount">{{i}}</div> -->
    </div>
    <div class="vip_icon" v-if="!is_vip && !is_hide_vip">
      <em class=""></em>加入会员,预计可返利{{data.discount}}元
    </div>
    <div class="prd_price shop-price" v-if='!is_vip'>
      <span style="color:#E91F3F;font-size:16px;padding-right:10px;">¥{{data.product_unit_price}}</span>
      <span style="color:#999999;font-size:12px;text-decoration:line-through;">¥{{data.product_market_price}}</span>
    </div>
    <div class="prd_price shop-price vip_price" v-if="is_vip">
      <span style="color:#17273A;font-size:16px;padding-right:5px;">¥{{data.product_unit_price}}</span>
      <span style="color:#17273A;font-size:12px;" v-if="parseFloat(data.discount) > 0">/ </span>
      <span style="color:#E91F3F;font-size:12px;" v-if="parseFloat(data.discount) > 0"> 赚{{data.discount}}</span>
    </div>
  </div>
  <!-- <slot name="big-btn"></slot> -->
</div>
</template>

<script>
export default {
  props: ['data', 'user_info', 'radius', 'is_hide_vip'],
  data () {
    return {
      is_vip: false
    }
  },
  created () {
    if (this.user_info && this.user_info.lev_code !== 'COMMON_USER') {
      this.is_vip = true
    } else {
      this.is_vip = false
    }
  },
  methods: {
    goBuy () {
      let isMini = sessionStorage.getItem('isMini')
      let item = this.data
      let params = '?pid=' + item.product_id + '&item_id=' + item.default_item_id
      if (isMini) {
        window.wx.miniProgram.navigateTo({ url: '/pages/shopDetails/shopDetails' + params })
      } else {
        this.$router.push('/main/shopDetails' + params)
      }
    }
  }
}
</script>

<style lang="css" scoped>
</style>
